<template>
  <el-card style="margin-bottom:20px;">
    <div slot="header" class="clearfix">
      <span>个人信息</span>
    </div>

    <div class="user-profile">
      <div class="box-center">
        <pan-thumb :image="user.avatar" :height="'100px'" :width="'100px'" :hoverable="false">
          <div>Hello</div>
          {{ user.role }}
        </pan-thumb>
      </div>
    </div>

    <div class="user-bio">
      <ul class="user-info">
        <li class="item">
          <svg-icon icon-class="user" />用户名称
          <div class="pull-right">{{ user.name }}</div>
        </li>

        <li class="item">
          <i class="el-icon-mobile-phone" />手机号码
          <div class="pull-right">{{ user.name }}</div>
        </li>

        <li class="item">
          <svg-icon icon-class="email" />用户邮箱
          <div class="pull-right">{{ user.name }}</div>
        </li>

        <li class="item">
          <svg-icon icon-class="tree" />部门/岗位
          <div class="pull-right">{{ user.name }}/{{ user.name }}</div>
        </li>

        <li class="item">
          <i class="el-icon-date" />创建时间
          <div class="pull-right">{{ user.name }}</div>
        </li>
      </ul>
    </div>
  </el-card>
</template>

<script>
import PanThumb from '@/components/PanThumb'

export default {
  components: { PanThumb },
  props: {
    user: {
      type: Object,
      default: () => {
        return {
          name: '',
          email: '',
          avatar: '',
          role: ''
        }
      }
    }
  }
}
</script>

<style lang="scss" scoped>
$borderColor: #e7eaec;
$itemHeight: 2.375rem;

.box-center {
  margin: 0 auto;
  display: table;
}

.text-muted {
  color: #777;
}

.user-profile {
  .user-name {
    font-weight: bold;
  }

  .box-center {
    padding-top: 10px;
  }
}

.user-bio {
  color: #303133;
  font-size: 0.8125rem;
  .user-info{
    padding: 0;
    list-style: none;
    .item{
      position: relative;
      height: $itemHeight;
      line-height: $itemHeight;
      padding-left: 1rem;
      border-top: 1px solid $borderColor;
      border-bottom: 1px solid $borderColor;
      margin-bottom: -1px;

      .svg-icon,i{
        position: absolute;
        left: 0;
        height: $itemHeight;
        line-height: $itemHeight;
      }

      .pull-right{
        position: absolute;
        right: 0;
        top: 0;
      }
    }
  }
}
</style>
